package com.bm.util;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

public class Config {
	private String redisHost;
	private int redisPort;
	private String redisChannelTrade;
	private String redisChannelMember;
	private String redisChannelUser;
	private String drive;
	private String url;
	private String user;
	private String password;
	private int InitialSize;
	private int MinIdle;
	private int MaxActive;
	private int RedisMaxActive;
	private int RedisMaxIdle;
	private int RedisMaxWait;
	private int RedisTimeOut;
	private boolean TESTONBORROW;
	//邮箱属性
	private String MailHost;   //服务器地址  
	private String MailSender; //发件人的邮箱  
	private String MailReceiver; //收件人的邮箱  
	private String MailUsername; //账号 
	private String MailPassword; //密码 
	
	private static Config config;
	

	public Config() {
		try {
			ClassLoader classloader = Thread.currentThread().getContextClassLoader();
			InputStream in = classloader.getResourceAsStream("com/bm/resource/config.properties");
			Properties prop = new Properties();
			prop.load(in);
			this.redisHost = prop.getProperty("redis_Host");
			this.redisPort = Integer.parseInt(prop.getProperty("redis_Port"));
			this.redisChannelTrade = prop.getProperty("redis_channel_trade");
			this.redisChannelMember =prop.getProperty("redis_channel_member");
			this.redisChannelUser =prop.getProperty("redis_channel_user");
			this.drive=prop.getProperty("drive");
			this.url=prop.getProperty("url");
			this.user=prop.getProperty("user");
			this.password=prop.getProperty("password");
			this.InitialSize=Integer.parseInt(prop.getProperty("InitialSize"));
			this.MinIdle=Integer.parseInt(prop.getProperty("MinIdle"));
			this.MaxActive=Integer.parseInt(prop.getProperty("MaxActive"));
			this.RedisMaxActive=Integer.parseInt(prop.getProperty("Redis_MaxActive"));
			this.RedisMaxIdle=Integer.parseInt(prop.getProperty("Redis_MaxIdle"));
			this.RedisMaxWait=Integer.parseInt(prop.getProperty("Redis_MaxWait"));
			this.RedisTimeOut=Integer.parseInt(prop.getProperty("Redis_TimeOut"));
			this.MailHost=prop.getProperty("Mail_Host");
			this.MailSender=prop.getProperty("Mail_Sender");
			this.MailReceiver=prop.getProperty("Mail_Receiver");
			this.MailUsername=prop.getProperty("Mail_Username");
			this.MailPassword=prop.getProperty("Mail_Password");
		} catch (Exception e) {
			// TODO: handle exception
		}
	}
	
	public static Config getConfig(){
		config= new Config();
		return config;
	}
	
	public String getRedisHost() {
		return redisHost;
	}

	public void setRedisHost(String redisHost) {
		this.redisHost = redisHost;
	}

	public int getRedisPort() {
		return redisPort;
	}

	public void setRedisPort(int redisPort) {
		this.redisPort = redisPort;
	}
	
	
	public String getRedisChannelTrade() {
		return redisChannelTrade;
	}

	public void setRedisChannelTrade(String redisChannelTrade) {
		this.redisChannelTrade = redisChannelTrade;
	}

	public String getRedisChannelMember() {
		return redisChannelMember;
	}

	public void setRedisChannelMember(String redisChannelMember) {
		this.redisChannelMember = redisChannelMember;
	}

	public String getRedisChannelUser() {
		return redisChannelUser;
	}

	public void setRedisChannelUser(String redisChannelUser) {
		this.redisChannelUser = redisChannelUser;
	}

	public String getDrive() {
		return drive;
	}

	public void setDrive(String drive) {
		this.drive = drive;
	}

	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	public String getUser() {
		return user;
	}

	public void setUser(String user) {
		this.user = user;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public int getInitialSize() {
		return InitialSize;
	}

	public void setInitialSize(int initialSize) {
		InitialSize = initialSize;
	}

	public int getMinIdle() {
		return MinIdle;
	}

	public void setMinIdle(int minIdle) {
		MinIdle = minIdle;
	}

	public int getMaxActive() {
		return MaxActive;
	}

	public void setMaxActive(int maxActive) {
		MaxActive = maxActive;
	}

	public int getRedisMaxActive() {
		return RedisMaxActive;
	}

	public void setRedisMaxActive(int redisMaxActive) {
		RedisMaxActive = redisMaxActive;
	}

	public int getRedisMaxIdle() {
		return RedisMaxIdle;
	}

	public void setRedisMaxIdle(int redisMaxIdle) {
		RedisMaxIdle = redisMaxIdle;
	}

	public int getRedisMaxWait() {
		return RedisMaxWait;
	}

	public void setRedisMaxWait(int redisMaxWait) {
		RedisMaxWait = redisMaxWait;
	}

	public int getRedisTimeOut() {
		return RedisTimeOut;
	}

	public void setRedisTimeOut(int redisTimeOut) {
		RedisTimeOut = redisTimeOut;
	}

	public boolean isTESTONBORROW() {
		return TESTONBORROW;
	}

	public void setTESTONBORROW(boolean tESTONBORROW) {
		TESTONBORROW = tESTONBORROW;
	}

	public String getMailHost() {
		return MailHost;
	}

	public void setMailHost(String mailHost) {
		MailHost = mailHost;
	}

	public String getMailSender() {
		return MailSender;
	}

	public void setMailSender(String mailSender) {
		MailSender = mailSender;
	}

	public String getMailReceiver() {
		return MailReceiver;
	}

	public void setMailReceiver(String mailReceiver) {
		MailReceiver = mailReceiver;
	}

	public String getMailUsername() {
		return MailUsername;
	}

	public void setMailUsername(String mailUsername) {
		MailUsername = mailUsername;
	}

	public String getMailPassword() {
		return MailPassword;
	}

	public void setMailPassword(String mailPassword) {
		MailPassword = mailPassword;
	}

	

	
}
